#!/usr/bin/perl
#
$totalRules = 0;
while($line=<STDIN>) {
	($a,$b,$left,$right)=split(/\s+/,$line);
	if($b>$ARGV[0]) {
		@c = split(/\-+/,$right);
		$index=1;		
		$monotone = 1;
		for($i=0;$i<@c;$i++) {
			$c[$i]=~/.*:([0-9]+)$/;
			$q = $1;
			if($index!=$q) {
				$monotone=0;
				last;
			}
			$index++;
		}
		$totalRules++;
		$numMonotones+=$monotone;

		$nodes+=$b;
		$numMonotonesTok+=$monotone*$b;
	}
}

print $numMonotones*100/$totalRules."\t";
print $numMonotonesTok*100/$nodes."\n";
